﻿Imports Microsoft.VisualBasic
Imports System.Configuration.ConfigurationManager
Imports System.Data
Imports System.Data.SqlClient
Imports System.Drawing
Imports System.IO
Imports System

Public Class LogueoAdministrador

    'instanciar la conexion
    Dim cn As New SqlConnection(ConnectionStrings("cn").ConnectionString)


    Public Function Logueo(ByVal Nombre As String, ByVal Contraseña As String) As Integer

        Try


            Dim da As New SqlDataAdapter("usp_LogueoAdministrador", cn)
            da.SelectCommand.CommandType = CommandType.StoredProcedure
            da.SelectCommand.Parameters.Add("@usuario", SqlDbType.VarChar, 100).Value = Nombre
            da.SelectCommand.Parameters.Add("@cont", SqlDbType.VarChar, 100).Value = Contraseña

            Dim dt As New DataTable
            da.Fill(dt)

            Dim cont As Integer = CType(dt.Rows(0).Item("CONT").ToString, Integer)

            Return cont

        Catch ex As Exception

            Return 0

        End Try
    End Function

End Class
